import "package:flutter/material.dart";
import "./RecommendItemContent.dart";
import "RecommendItemUPInfo.dart";

// 会员购类型推荐的会员购类
class RecommendItemShopItem {
  String coverUrl; //封面图
  String viewCount; //浏览量
  String hotCount; //热度
  String title; //标题
  RecommendItemShopItem({
    required this.coverUrl,
    required this.viewCount,
    required this.hotCount,
    required this.title,
  });
}

// 会员购类型推荐的会员购类
class RecommendItemShopItemWidget extends StatelessWidget {
  final RecommendItemShopItem recommendItemShopItem;
  final RecommendItemUPInfo? recommendItemUPInfo;
  const RecommendItemShopItemWidget({
    super.key,
    required this.recommendItemShopItem,
    this.recommendItemUPInfo,
  });
  @override
  Widget build(BuildContext context) {
    TextStyle textStyle = const TextStyle(
      fontSize: 10,
      color: Colors.white,
    );
    return RecommendItemContentWidget(
      imageUrl: recommendItemShopItem.coverUrl,
      title: recommendItemShopItem.title,
      imageBottomBar: Padding(
        padding: const EdgeInsets.fromLTRB(5, 4, 5, 2),
        child: Row(
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          crossAxisAlignment: CrossAxisAlignment.center,
          children: [
            Expanded(
              flex: 1,
              child: Row(
                children: [
                  const Icon(
                    Icons.supervisor_account_rounded,
                    size: 12,
                    color: Colors.white,
                  ),
                  Padding(
                    padding: const EdgeInsets.only(left: 3),
                    child: Text(
                      recommendItemShopItem.viewCount,
                      style: textStyle,
                    ),
                  ),
                ],
              ),
            ),
            Expanded(
              flex: 1,
              child: Row(
                children: [
                  const Icon(
                    Icons.local_fire_department_outlined,
                    size: 12,
                    color: Colors.white,
                  ),
                  Padding(
                    padding: const EdgeInsets.only(left: 3),
                    child: Text(
                      recommendItemShopItem.hotCount,
                      style: textStyle,
                    ),
                  ),
                ],
              ),
            ),
          ],
        ),
      ),
      footer: Row(
        children: [
          Container(
            padding: const EdgeInsets.fromLTRB(4, 0, 4, 0),
            decoration: BoxDecoration(
              border: Border.all(
                  color: const Color.fromARGB(255, 255, 130, 172), width: 0.5),
              borderRadius: BorderRadius.circular(2),
            ),
            child: const Text(
              '会员购',
              style: TextStyle(
                color: Color.fromARGB(255, 255, 125, 168),
                fontSize: 10,
              ),
            ),
          ),
          Expanded(
            flex: 1,
            child: Padding(
              padding: const EdgeInsets.only(left: 4),
              child: Text(
                recommendItemUPInfo?.name ?? '',
                maxLines: 1,
                overflow: TextOverflow.ellipsis,
                style: const TextStyle(
                  color: Colors.black54,
                  fontSize: 12,
                ),
              ),
            ),
          )
        ],
      ),
    );
  }
}
